---
import { Code } from '@astrojs/starlight/components';

const code = `
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class CounterPage extends StatelessWidget {
  const CounterPage({super.key});

  @override
  Widget build(BuildContext context) {
    final count = context.watch<CounterBloc>().state;

    return Column(
      children: [
        Text('Count: $count'),
        ElevatedButton(
          onPressed: () {
            context.read<CounterBloc>().add(CounterIncrement());
          },
          child: const Text('Increment'),
        ),
      ],
    );
  }
}
`;
---

<Code code={code} lang="dart" title="counter_page.dart" />
